package club.janna.diveinspringboot.autoconfigure.bootstrap;

import club.janna.diveinspringboot.autoconfigure.service.UserService;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;

@ComponentScan(basePackages = "club.janna.diveinspringboot.autoconfigure.service")
public class ComponentBootstrap {
    public static void main(String[] args) {
        ConfigurableApplicationContext context = new SpringApplicationBuilder(ComponentBootstrap.class)
                .web(WebApplicationType.NONE)
                .run(args);
        UserService userService = (UserService) context.getBean("userService");
        System.out.println(userService);
    }
}
